﻿<!--#include file="app/inc/conn.asp"-->
<%
Call OpenData()
qcity = request.QueryString("city")
qMinPrice = request.QueryString("minprice")
qMaxPrice = request.QueryString("maxprice")
if qcity <> "" then qStr = qStr & "&city=" & qcity : sqlStr = sqlStr & " and city='" & qcity & "'"
'if qMinPrice <> "" then qStr = qStr & "&minprice=" & qMinPrice
'if qMaxPrice <> "" then qStr = qStr & "&maxprice=" & qMaxPrice
Randomize()
set rs = server.CreateObject("adodb.recordset")
if request.QueryString("p") = "" or not isnumeric(request.QueryString("p")) then
	sql = "select id,name,city,price,photopath from sexy where photopath <> ''"& sqlStr &" order by Rnd(-(ID + " & Int((10000 * Rnd) + 1) & "))"
else
	sql = "select id,name,city,price,photopath from sexy where photopath <> ''"& sqlStr &" order by id desc"
End if
rs.open sql,conn,1,1
str = ""
if not (rs.eof and rs.bof) then
	'分页
	dim currentpage
	maxperpage=30 '信息显示条数
	rs.pagesize=maxperpage
	currentpage=request.QueryString("p")
	if currentpage="" or not isnumeric(currentpage) then
		currentpage=1
	elseif currentpage<1 then
		currentpage=1
	else
		currentpage=clng(currentpage)
		if currentpage > rs.pagecount then
			currentpage=rs.pagecount
		end if
	end if
	
	if not isnumeric(currentpage) then
		currentpage=1
	end if
	dim totalput,n
		totalput=rs.recordcount
	if totalput mod maxperpage=0 then
		n=totalput\maxperpage
	else
		n=totalput\maxperpage+1
	end if
	if n=0 then
		n=1
	end if
	rs.move(currentpage-1)*maxperpage
	i = 0
	w = 1
	do while i< maxperpage and not rs.eof
		ID = rs("ID")
		Name = rs("Name")
		City = rs("City")
		'age = rs("age")
		'height = rs("Height")
		'weight = rs("weight")
		price = rs("Price")
		'tel = rs("Tel")
		'qq = rs("QQ")
		photopath = rs("photopath")
		if photopath <> "" then
			photoArr = split(photopath,"|")
			headpic = sitepath & "photo/thumb/"&PhotoArr(0)
		else
			headpic = ""
		end if
		If w Mod 2 = 0 then	
			str = str & "<figure class='hproduct'>"
		Else
			str = str & "<figure class='hproduct alt'>"
		End If
		str = str & "<a href='"&sitepath&"detail/" & id & "'><img class='photo' src='" & headpic & "' alt='" & Name & "' /></a>"
		str = str & "<figcaption>"
		str = str & "<p><a href='"&sitepath&"detail/" & id & "' class='url'><strong class='fn'>" & Name & "</strong></a></p>"
		str = str & "<p class='meta'><span>" & city & "</span> - <ins class='price'>" & price & "</ins>/小时</p>"
		str = str & "</figcaption>"
		str = str & "</figure>"
		If w Mod 5 = 0 Then str = str & "<hr class='split-line'/>"
		
		i = i + 1
		w = w + 1
		rs.movenext
	loop
else
	str = "<p>Null!</p>"
end if
rs.close
set rs = nothing
'page
pageCount = n
If currentpage>1 Then 
	pageStr = pageStr & "<a href='?p="&currentpage-1&qStr&"'>&laquo; Previous</a>"
Else
	pageStr = pageStr & "<span class='disabled'>&laquo; Previous</span>"
End if
If pageCount<=10 Then
	For i = 1 To pageCount
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
else
	For i = 1 To 2
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
	If currentpage>6 Then 
		pageStr = pageStr & "..."
	End if

	ks =  currentpage-3
	If ks <1 Then ks =1
	For i = ks To currentpage+3
		If i>=pageCount-1 Then Exit For
		If i>2 Then  
			If i = currentpage Then 
				pageStr = pageStr & "<span class='current'>"&i&"</span>"
			Else
				pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
			End if
		End If
	Next

	If pageCount-1-(currentpage+3)>1  Then
		pageStr = pageStr & "..."
	End if

	For i = pageCount-1 To pageCount
		If i = currentpage Then 
			pageStr = pageStr & "<span class='current'>"&i&"</span>"
		Else
			pageStr = pageStr & "<a href='?p="&i&qStr&"'>"&i&"</a>"
		End if
	Next
End if

If currentpage<pageCount Then 
	pageStr = pageStr & "<a href='?p="&currentpage+1&qStr&"'>Next &raquo;</a>"
Else
	pageStr = pageStr & "<span class='disabled'>Next &raquo;</span>"
End If
set rsCity = server.CreateObject("adodb.recordset")
sql = "select distinct city from sexy"
rsCity.open sql,conn,1,1
if not rsCity.eof then
	do while not rsCity.eof
		cityStr = cityStr & "<a href='?city="&rsCity("city")&"'>"&rsCity("city")&"</a> "
	rsCity.movenext
	loop
else
	cityStr = "<p>No data!</p>"
end if
%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>那些年，我们一起插的女孩</title>
	<link rel="stylesheet" href="<%=sitepath%>theme/css/main.css">
	<!--[if IE]><script src="<%=sitepath%>js/html5.js"></script><![endif]-->
</head>
<body>
<header>
<div class="pg-inner">
<h1 class="logo">一起</h1>
</div>
</header>
<section class="page-bd">
<div class="pg-inner">
<div class="about">现代生活节奏不断加快，工作紧张忙碌，当您拖着疲惫的身体回到家中的时候，多么希望有一种方式来缓解一天的疲劳。<br>其实，不出门又能消除疲劳的方法很多，专业保健技师“上门服务”就是其中一种。<br>一起网竭诚为广大朋友提供最新最好最具信誉的“保健”信息。<a href="" class="btn-add"><i class="ico-add">+</i><b class="txt">免费发布</b></a></div>
<div class="filter">
	<div class="citys"><%=cityStr%></div>
</div>
<div class="list cf"><%=str%></div>
<div class="pages"><%=pageStr%></div>
</div>
</section>
<footer class="page-ft">
	<div class="pg-inner"><address class='copyright'>&copy;2011-2012 一起·×××</address></div>
</footer>
<script type="text/javascript" src="http://js.tongji.linezing.com/1120361/tongji.js"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/1120361/tongji.gif"/></a></noscript>
</body>
</html>